package com.template;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class EasyReadTemplate extends AnalysisEventListener<Map<Integer, String>> {
       /*
        用于Easy无模型对象时，读取数据
       */
    private List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
    @Override
    public void invoke(Map<Integer, String> data, AnalysisContext analysisContext) {
        list.add(data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("数据读取结束");
    }
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {

        list.add(headMap);//包括标头
    }
    public  List<Map<Integer, String>> getList(){
        return list;
    }
    public  void  initList(){
        list=new ArrayList<>();
    }
}
